CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(utils)
SET(CMAKE_C_STANDARD 11)
SET(CMAKE_CXX_STANDARD 11)

IF (EXISTS "/opt/rh/devtoolset-2/root/usr/bin/gcc")
    SET(CMAKE_C_COMPILER "/opt/rh/devtoolset-2/root/usr/bin/gcc")
ENDIF ()
IF (EXISTS "/opt/rh/devtoolset-2/root/usr/bin/c++")
    SET(CMAKE_CXX_COMPILER "/opt/rh/devtoolset-2/root/usr/bin/c++")
ENDIF ()

MESSAGE("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g -fPIC -Wall -std=c++11 -D_REENTRANT -DUSE_APACHE -DNO_STRING_CIPHER")
SET(TARGET "utils")
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../lib/release_linux/libUtils)
#SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)

AUX_SOURCE_DIRECTORY(src SOURCE_DIRS_SRC)
#AUX_SOURCE_DIRECTORY(src/test SOURCE_DIRS_SRC_TEST)

IF (APPLE)
    INCLUDE_DIRECTORIES(/usr/local/brew/Cellar/openssl/1.0.2g/include)
ENDIF (APPLE)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/utils)

LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../lib/release_linux/libUtils)

ADD_LIBRARY(${TARGET} STATIC ${SOURCE_DIRS_SRC})
#ADD_EXECUTABLE(${TARGET} ${SOURCE_DIRS_SRC} ${SOURCE_DIRS_SRC_TEST})

TARGET_LINK_LIBRARIES(${TARGET} -lcrypto -luuid -ldl)
